import Vue from 'vue'
import VueRouter from 'vue-router'
//获取原型对象上的push函数
const originalPush = VueRouter.prototype.push
//修改原型对象中的push方法
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

Vue.use(VueRouter)

export const routes = [
  {
    path: '/login',
    name: 'Login',
    meta: {
      menu: '登录'
    },
    component: () => import('@/views/login')
  },
  {
    path: '/',
    name: 'main',
    redirect: "/admin/index",
    component: () => import('@/views/home'),
    children: [
      {
        path: '/admin/umvc/vipUserDetail',
        meta: {
          menu: '会员信息详情'
        },
        component: () => import('@/views/admin/umvc/memberDetail.vue')
      }
    ]
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
